package com.cloud.controller;

import com.cloud.pojo.ReagentResult;
import com.cloud.pojo.ReagentUser;
import com.cloud.pojo.SamplingInfo;
import com.cloud.service.DataTranFeignService;
import com.cloud.tools.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Author: Tangtao
 * @Date: 2022/5/5 9:17
 * @Description: Access the user data transfer service provider
 * @ClassName: DataTranController
 */

@RestController
public class DataTranController {

    @Resource
    private DataTranFeignService dataTranFeignService;

    /* 提交试剂瓶信息 及对应 志愿者Id */
    @PostMapping(value = "/natms/reagent/Info")
    public CommonResult saveReagentInfo(@RequestBody SamplingInfo samplingInfo){
        return dataTranFeignService.saveReagentInfo(samplingInfo);
    }

    /* 提交试剂瓶对应的核酸检测用户信息 */
    @PostMapping(value = "/natms/reagent/UserInfo")
    public CommonResult saveReagentUserInfo(@RequestBody List<ReagentUser> list){
        return dataTranFeignService.saveReagentUserInfo(list);
    }


    /* 用户对于检测结果的查询 */
    @GetMapping(value = "/natms/result/check")
    public CommonResult checkTestResult(){
        return dataTranFeignService.checkTestResult();
    }

    /* 医护人员进行检测结果的单个上传 */
    @PostMapping(value = "/natms/result/doctorSend/one")
    public CommonResult saveTestResultOnce(@RequestBody ReagentResult reagentResult){
        return dataTranFeignService.saveTestResultOnce(reagentResult);

    }

    /* 医护人员进行检测结果的批量上传 */
    @PostMapping(value = "/natms/result/doctorSend/batch")
    public CommonResult saveTestResultBatch(@RequestBody List<ReagentResult>  reagentResultList){
        return dataTranFeignService.saveTestResultBatch(reagentResultList);
    }

    /* 管理员进行检测结果的修改 */
    @PostMapping(value = "/natms/result/managerUpdate")
    public CommonResult resultManage(@RequestBody ReagentResult reagentResult){
        return dataTranFeignService.resultManage(reagentResult);
    }

    @GetMapping(value = "/natms/region/allInfo")
    public CommonResult getRegion(){
        return dataTranFeignService.getRegion();
    }

    @PostMapping(value = "/natms/reagent/ManagerGetResult")
    public CommonResult getResultFromUserId(@RequestBody Map<String,String> map){
        return dataTranFeignService.getResultFromUserId(map);
    }

    @GetMapping(value = "/natms/reagent/Allresult")
    public CommonResult getAllResult(){
        return dataTranFeignService.getAllResult();
    }

    @PostMapping(value = "/natms/result/delete")
    public CommonResult resultDelete(@RequestBody Map<String,String> map){
        return dataTranFeignService.resultDelete(map);
    }

}
